package com.bjpowerndoe.ylb;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.bjpowerndoe.ylb.web.config.RealnameConfig;
import com.bjpowerndoe.ylb.web.config.SmsConfig;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableScheduling
@EnableConfigurationProperties({SmsConfig.class, RealnameConfig.class})
@EnableSwaggerBootstrapUI
@EnableSwagger2
@MapperScan(basePackages = "com.bjpowerndoe.ylb.mapper")
@SpringBootApplication
public class YlbApplication {

    //MyBatis+Plus分页插件
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

    public static void main(String[] args) {

        SpringApplication.run(YlbApplication.class, args);
    }

}
